#ifndef __config_h
#define __config_h
#include "platform.h"
#include "system.h"


// - - - - - - - - - - - - - - -
// General platform definitions
// - - - - - - - - - - - - - - -
#define PLATFORM_TYPE EA_USB2SERIAL
//#define PLATFORM_CLOCK 12000000
#define PLATFORM_CLOCK 48000000

// - - - - - - - - - - - - - - - - - - - - 
// pic_serial defines
// - - - - - - - - - - - - - - - - - - - - 
#define SERIAL_DISCARD_ON_TX_FULL_DURING_INT
#define SERIAL_TX_BUFFER_SIZE 32
#define SERIAL_RX_BUFFER_SIZE 16
//#define SERIAL_DEBUG_ON

// USB CDC defines

#define USB_CDC_TX_BUFFER_SIZE 32
#define USB_CDC_RX_BUFFER_SIZE 16
#define USB_CDC_DATA_ENDPOINT 3
//#define CDC_DEBUG
//#define CDC_IDE_DEBUG

// USB defines

//#define USB_DEBUG
//#define USB_DEBUG_HIGH

#define USB_HIGHEST_EP 3
#define USB_SELF_POWERED
//#define USB_BUS_POWERED

#define USB_EP0_OUT_E_SIZE 8
#define USB_EP0_OUT_E_ADDR 0x0280
#define USB_EP0_OUT_O_SIZE 8
#define USB_EP0_OUT_O_ADDR 0x0288

#define USB_EP0_IN_SIZE 8
#define USB_EP0_IN_ADDR 0x0290

// EP1 not used

#define USB_EP2_IN_SIZE		8
#define USB_EP2_IN_ADDR		0x0298

#define USB_EP3_OUT_SIZE	8
#define USB_EP3_OUT_ADDR	0x02a0
#define USB_EP3_IN_SIZE		8
#define USB_EP3_IN_ADDR		0x02a8

#define USB_CALLBACK_ON_SOF
// if you define it, you'll need to include this routine in your code:
// void usb_SOF_callback(uns16 frame) {
//	}

#define USB_CALLBACK_ON_DEVICE_CONFIGURED
// if you define it, you'll need to include this routine in your code:
// void usb_device_configured_callback() {
//	}

#define USB_CALLBACK_ON_CLASS_CTRL
// if you define it, you'll need to include these routines in your code:
//void usb_handle_class_ctrl_read_callback();	
//void usb_handle_class_ctrl_write_callback(uns8 *data, uns16 count);
//void usb_handle_class_request_callback(setup_data_packet sdp);

#define USB_EP_DATA_CALLBACK
// if you define it, you'll need to include these routines in your code:
//void usb_ep_data_out_callback(uns8 end_point, uns8 *buffer_location, uns16 byte_count);
//void usb_ep_data_in_callback(uns8 end_point, uns16 byte_count);

#define lcd_e_port   PORTC
#define lcd_rs_port  PORTC
#define lcd_rw_port  PORTC
#define lcd_db7_port PORTB
#define lcd_db6_port PORTB
#define lcd_db5_port PORTB
#define lcd_db4_port PORTB

#define lcd_e_pin   0
#define lcd_rs_pin  2
#define lcd_rw_pin  1
#define lcd_db7_pin 7
#define lcd_db6_pin 6
#define lcd_db5_pin 5
#define lcd_db4_pin 4


#endif
